﻿namespace AiMoWindows.Localization
{
    static class Local
    {
        //static readonly int[] chineseIds = new int[]
        //{
        //    2052,
        //    3076,
        //    5124,
        //    4100,
        //    1028
        //};
        ////https://wiki.freepascal.org/Language_Codes
        public static bool RunningInChinese { get; private set; } = true;

        public static void SwapLanguage()
        {
            RunningInChinese = !RunningInChinese;
        }

        public static string Get(string key)
        {
            if (RunningInChinese && CN.TryGetValue(key, out string? value)) return value;
            return key;
        }
        static readonly Dictionary<string, string> CN = new Dictionary<string, string>()
        {
            {" is existed"," 已经存在" },
            {"!! ATTENTION !!","！有消息！" },
            {"!! UPDATE !!","有新版本" },
            {"Ai does not response to this question. Change it and ask again.","AI看上去没有回应这个问题，请改变问法再试一次。" },
            {"AiMo is in readonly mode, there is no Rhino or Grasshopper connected. Cannot run code.","AiMo 在只读模式，没有连接到 Rhino 或者 Grasshopper，无法执行代码。" },
            {"AiMoScript version is not compatible with current AiMo. Please update to the latested version. ","AiMoScript 代码版本比当前版本新，请去官网下载最新的AiMo。" },
            {"Already saved in file:", "已保存了同样的代码，文件：" },
            {"Already sent share code to cloud. ShareKey has been copy to clipboard.", "代码分享成功，分享码已经复制到剪贴板："},
            {"Analysis replied code error. May be the format is not supported by current CodeEditor.", "分析返回的代码失败，可能编辑器无法支持返回的代码格式。" },
            {"Are you sure to logout?", "你确认要登出吗？" },
            {"Ask AI fail. Try again, or check log file.","询问AI失败，请重试，或查看Log文件并联系开发者" },
            {"Cancel","取消" },
            {"Cannot add none external assembly aimo scripts to library. (No CSharpScriptInstance class)","无法添加库代码到命令库中。不包含（CSharpScriptInstance）" },
            {"Cannot change name {0} to {1}, '{2}' should not exist","无法重命名 {0} 为 {1}, 不应该出现字符 '{2}'" },
            {"Cannot complie script:","无法编译代码：" },
            {"Cannot connect to server, please check your network","无法连接到服务器，请检查网络" },
            {"Cannot delete {0}{1}{2}" ,"无法删除 {0}{1}{2}"},
            {"Cannot download code. Please login.","无法下载分享代码,请登录。" },
            {"Cannot download code.","无法下载分享代码。" },
            {"Cannot get valid result from reply.","无法获取有效的回复结果。" },
            {"Cannot override readonly file","无法覆盖只读文件" },
            {"Cannot read Script from path {0}{1}{2}" ,"无法读取代码，路径：{0}{1}{2}"},
            {"Cannot rename the file {0} to {1}{2}{3}","无法重命名文件 {0} 为 {1}{2}{3}" },
            {"Cannot run Grasshopper script in Rhino as a Rhino AiMo command","无法执行 Grasshopper 代码在 Rhino 中，作为一个 Rhino AiMo 命令。" },
            {"Cannot run Rhino commmand script in Grasshopper as an AiMo C# commponent","无法执行 Rhino 命令代码在 Grasshopper 中，作为一个 AiMo C# 电池" },
            {"Cannot set namespace when compile code for AiMo Rhino","无法设置命名空间（namespace），当需要编译给Rhino执行的AiMo代码。" },
            {"Cannot set namespace when compile code for AiMo Grasshopper","无法设置命名空间（namespace），当需要编译给Grasshopper执行的AiMo代码。" },
            {"Cannot set same paramName with different data type","不同的数据类型，无法设置相同的 GH 参数名" },
            {"Cannot send empty Message","无法发送空问题" },
            {"Cannot send too short message","无法发送过短的问题" },
            {"Cannot save assembly file to path:","无法保存库文件到路径：" },
            {"Cannot found public class inheriting CSharpScriptInstance", "无法找到继承 CSharpScriptInstance 的 public 主类" },
            {"Code has been copied to \"C# Editor\". Switch mode to test.","代码已经被复制到“C# 编辑器”。请转到编辑器去测试。" },
            {"Code name cannot be empty.","代码名字不能为空" },
            {"Code Sync Error:", "代码同步错误："},
            {"Code name must have more than 4 characters.","代码名字必须有四个以上字符" },
            {"Compile Command from","编译命令文件" },
            {"Compile Error:","编译错误：" },
            {"Compile rhp error {0}","rhp插件编译错误 {0}" },
            {"Compiled {0} script items in {1} s","编译成功 {0} 个命令，耗时 {1} s" },
            {"Compiled in {0:f3} sec","编译耗时 {0:f3} 秒" },
            {"Connect to server error. Try again, or check log file.","无法连接到服务器，请重试，或查看Log文件并联系开发者" },
            {"Create date: ","创建日期：" },
            {"Current script has wrong format, and cannot save. Do you want to continue without save?","当前代码格式不正确无法同步。是否不保存代码，并继续？" },
            {"Current Ai coding is in free trial. ", "当前AI辅助代码正在免费试用期。" },
            {"Current command {0} is written by {1}, ","命令 {0} 作者： {1}" },
            {"Dll assemblies (*.dll)|*.dll|All (*.*)|*.*","Dll 文件 (*.dll)|*.dll|所有文件 (*.*)|*.*" },
            {"Do you want to keep showing this attention?","是否还想继续显示这个通知" },
            {"Done.","结束。" },
            {"Download Error: ","下载失败：" },
            {"Downloaded code from: ","成功下载代码：" },
            {"Downloaded code runinng in AiMoRhino version {0}, is not same with current AiMoRhino version {1}. This may cause problems.","下载的代码原Rhino版本为{0}，和当前Rhino版本{1}不一致，可能为导致调用方法不存在等问题。" },
            {"Empty scripts","空代码"},
            {"Expire date:","过期时间：" },
            {"Export commands to Rhp file","将命令库导出为Rhino插件" },
            {"Fail from messenger connect, try again later.","无法连接服务器，请稍后再试。" },
            {"Fail from send Message to server, try again later.", "发送数据到服务器错误，请稍后再试。" },
            {"Fail from transfer message, try again later.","传输数据出现错误，请稍后再试。" },
            {"File {0} is occupied, please restart AiMo than try again.","文件 {0} 被占用。请重启 AiMo 后再试一次" },
            {"File not exist ","文件不存在 " },
            {"Find {0} script items can be export.","总共有 {0} 个代码可以导出命令"},
            {"If you have resubscribed, please login again to refresh.", "如果已经续订，请重新登录以刷新" },
            {"If you open AiMo not through the \"AiMo\" command in Rhino, you can only compile DLLs but not run scripts within Rhino.", "如果您不是通过Rhino中的“AiMo”命令打开AiMo，那么只能编译DLL，而无法在Rhino中运行脚本。" },
            {"Input name cannot be empty","输入名字不能为空" },
            {"Input name format error, only contains: a-z/A-Z/0-9","命令名字只能为英文字符以及数字"},
            {"Line {0}: Method {1} is not supported. Use {2} instead.", "行 {0}：不支持函数 {1} ，请使用{2}替代。" },
            {"Line {0}: Method {1} is not supported.", "行 {0}：不支持函数 {1} 。" },
            {"Load Command from","载入命令文件" },
            {"Loaded Command","载入命令" },
            {"Must contains only one Main() method in the CSharpScriptInstance class", "主类 CSharpScriptInstance 必须包含 Main() 方法"},
            {"Must contains only one SolveInstance() method in the GHCSharpScriptInstance class", "主类 GHCSharpScriptInstance 必须包含 SolveInstance() 方法"},
            {"Must use const string as paramName:","必须使用常量字符串作为 GH 参数名：" },
            {"New version is available, click \"OK\" to open down web page","发现新版本，点击“确认”打开下载页" },
            {"No scripts items can be export","库中没有代码可以导出Rhino插件" },
            {"No external reference.","没有外部引用文件。" },
            {"Only .AiMoScript file can be loaded","只有 .AiMoScript 文件能被载入" },
            {"Only login users can download codes", "只有登录的用户才能下载代码"},
            {"Only login users can share codes", "只有登录的用户才能分享代码"},
            {"Open AiMo Script","打开Aimo代码" },
            {"Opened code from:", "成功打开代码：" },
            {"Password should be at least 6 characters","密码必须至少6个字符" },
            {"Please input author name to export rhino plugin","请输入作者，以导出Rhino插件" },
            {"Please input valid ShareKey", "分享码格式不正确"},
            {"Please set item Command Name to export rhp","需要导出插件的代码需要设置命令名字" },
            {"Reply cancelled", "取消回复" },
            {"Reference file (#r {0}) is not fully file path.", "外部引用 (#r {0}) 不是完整的文件路径."},
            {"Reference file (#r {0}) is not existed.", "外部引用 (#r {0}) 文件不存在。"},
            {"Save AiMo Script","保存AiMo代码" },
            {"Save code to file:", "代码保存到文件：" },
            {"Save Error:","保存失败：" },
            {"Script {0} and script {1} cannot share same export command English Name {3}","代码 {0} 和代码 {1} 不能有相同的导出命令英文名 {3}" },
            {"Script {0} cannot be exported. Reference Assemblies are not supported yet.","代码 {0} 无法导出。导出RHP暂时不支持引用外部Dll。" },
            {"Script {0} cannot be exported. Compile AiMo Grasshopper component into rhp is not supported.","代码 {0} 无法导出。导出RHP不支持 AiMo GH 代码。" },
            {"Script path {0} is invalid","代码路径 {0} 无效" },
            {"Scripts powered and exported by AiMo3D (https://aimo.zhai-zhai.com)","代码与插件生成来自AiMo3D (https://aimo.zhai-zhai.com)" },
            {"Server cannot find register info, please try again","暂时无法查询到登录信息，请重试" },
            {"Server connect error. Please check logs.","服务器通讯失败，请检查Logs。" },
            {"Server Reply Error: ","服务器回复错误代码：" },
            {"Share key is deleted by owner", "分享码已经被拥有者删除" },
            {"ShareKey is duplicate with existed. This case is rare. Please try again.", "分享码和已有的发生重复，这种情况比较少，请重试，会自动生成一个新的" },
            {"ShareKey not exist", "分享码不存在" },
            {"Start download code from: ","开始下载分享码：" },
            {"Subscription expired. Please open AiMo Community to subscribe.", "订阅已经过期，请打开【AiMo社区】网站续订。" },
            {"Subscription is valid. ","当前订阅有效。"},
            {"The param type in not clear, you can use {0}<T> to assign a specific type.", "GH 参数类型不明确，你可以使用 {0}<T> 限定类型。" },
            {"Trying expired:\r\nPlease open AiMo Community to subscribe.", "试用期结束：\r\n请打开【AiMo社区】网站，登录账号并订阅。" },
            {"Unknown error: ","未知错误：" },
            {"Updated external reference:", "更新外部引用：" },
            {"Upload Code Error:","上传代码错误：" },
            {"Uploading share code to cloud in backgound. Please wait a moment." ,"正在后台上传分享码，请稍等，不要关闭Aimo窗口。"},
            {"User key error","用户密码错误" },
            {"User name does not existed","用户名不存在" },
            {"Username should be at least 3 characters","用户名必须至少3个字符" },
            {"Warning" ,"警告"},
            {"Warning: you have not set any Input or Output Param of this Grasshopper Component.","警告：你没有设置任何 输入输出的 GH参数在当前的GH电池。" },
            {"Warning! It is recommended to set a namespace when compiling code from external assemblies.","警告！建议在编译外部程序集代码时设置命名空间。" },
            {"Your code not saved. Save before continue?" ,"你的代码没有保存，是否先保存再继续？"},
            {"You are opening a Rhino command AiMoScript in AiMo Grasshopper.\nThe code cannot be send to run in Grasshopper.","你正在 Grasshopper 中打开一个属于 Rhino 命令的代码。\n这个代码将无法在 AiMo Grasshopper C# 电池中执行。" },
            {"You are opening a Grasshopper C# Component AiMoScript in AiMo Rhino.\nThe code cannot be send to run as a Rhino Command.","你正在AiMo Rhino中打开一个属于 Grasshopper C# 电池的代码\n这个代码将无法作为 Rhino 命令执行。" },
        };
    }
}
